<!-- 
说明：<%- title %>列表
作者：<%- user %>
日期：<%- time %>
版本：1.0.0
-->
<template>
  <div>
    <mk-search-box><% fields_no_id.forEach(function(ele, index){%><%if(index % 3 === 0){%>
        <el-row><%}%>
            <el-col :span="5">
                <label><%- ele.comment %>:</label>
                <el-input v-model="ui.searchData.<%- ele.name %>"
                            size="small"></el-input>
            </el-col><%if(index === fields_no_id.length - 1){%>
            <el-col :span="3">
                <mk-search-buttons v-model="ui.searching" />
            </el-col><%}%><%if(index % 3 === 2 || index === fields_no_id.length - 1){%>
        </el-row><%}%><% }) %>
    </mk-search-box>
    <el-row>
      <add @reload="doSearch" />
    </el-row>
    <mk-table v-model="ui"
              mk-multiple
              mk-index
              mk-sql-code="<%- className %>.select_list"
              mk-table-id="<%- vueName %>.list.common"
              ref="table"><% fields_no_id.forEach(function(ele, index){%>
        <el-table-column align="left"
                prop="<%- ele.name %>"
                label="<%- ele.comment %>"
                sortable="custom"
                width="<%- ele.len || 20 %>" /><% }) %>        
      <el-table-column prop="doing"
                       align="center"
                       label="操作"
                       width="120">
        <template slot-scope="scope">
          <edit :row="scope.row" @reload="doSearch" />
        </template>
</el-table-column>
</mk-table>
</div>
</template>

<script>
  import {
    MkBase
  } from 'element-ui'
  import Add from './list/add-button'
  import Edit from './list/edit-button'
  import searchData from './list/search-data'

  export default {
    name: '<%- vueName %>-list',
    mixins: [MkBase],
    components: {
      Add,
      Edit
    },
    data () {
      return {
        ui: {
          searching: true,
          searchData: searchData()
        }
      }
    },
    methods: {
      /**
       * 刷新本页面
       */
      doSearch () {
        this.ui.searching = true
      }
    }
  }
</script>